More refactoring to prevent bugs similar to due_date bug