Refactored database code and added Day model