Adjusted time logic, minor cleanup