refactored stuff, added a sort filter