implement tests for keep rules
fix time sorting method