Tidy up code
Support filtering in URL