refactored code for creating expense and added option to edit expense