clean & polish the editing related code