delete functionality working correctly