Refactoring sunlighting (part 1)