working version with correction of sun latitude and sun distance