Added product edit feature and refactored some code