Refactored url mapping and fixed broken tests