Adding filtering, refactored some bad templating