Use switch instead of if-else to make more golang style control
structures
Also time.Sub should replaced by time.Since