sort keys by first occurence done, working on limiting dates