Added functions and events for editing record