Migrated time functions to factory. Also, fixed radio button bug.