Refactoring schedule/sunrise
Add tests