refactored Js created clock