code cleaning: remove unused date related code, move date processing functions to module level