Added delete function, minor fixes