Added some tests
Ordering records by ID and adding missing tests
Added a test to cover the case when a record is merged between 2 layers