refactor and add tests
added sort type for transaction ids