Refactoring: removing momentjs and using simple calculation for duration and position