add logging and better delete