added deletion function, fixed overzealous linking