various refactoring, preparing for date stuff