Satisfying solution for URL but need to work on refactoring