Edit functionality refactored
Editing works perfect now.