Refactored URL handling and views