Optimised algorithm for getting the next sun-event (sunrise/sunset). Optimised some values for the image pre-processing operation for better readability.