Refactored and moved moon phase functionality out of main.