refactored tests and added test to edit