Change date to return as a number. Also some cleanup and formatting