adds filtering, cleans up api, a bunch of stuff