Refactor out normalizeTime(), fix logic bug

Fix for issue #1