finalized refactoring based on delete cascade