improved backend logic, date compare