Implemented ordering and added integration tests.

TODO:

- remove comment to properly classify integration tests
- add unit tests for coverage