generation of delete statements, code refactor