Edit functionality added with validation.