added logging
fixed delete function