Added delete methods to avoid memory leaks