Refactor paypal ipn code