Refactored code into two files set/get and fixed a bug where the time wasn't updated