fixed destroy function, still need to work on editing