Refactored code and also implemented refund.