add isToday function, small refactorings