finished I5: refactoring. broke delete feature in the process