my own implementation for better understanding delete