fixed on delete cascade, but needs refactoring
before modifications to try and improve performance