moved functions around to make the findTime function work