updated the code to take amount