edit functionality, cleanup