refactoring to add timezone support