Refactored editing

Added cancel button and slightly changed logic