Final implementation of /edit handler.