cleaned up code and got the url filter function working