Refactored URL handler; simplified code by using default serializers