Added delete function as a method rather than a state