Make delete function properly