added more comments to explain steps, moved v calculation up a loop, sun still broken