Upload with correct time to endomondo. Small refactoring. Added more tests.