move edit function to admin page and add cleanup functionality