Modified Servlet as per Gaurav's suggestion