Cleaned up delete code