added database queries ofr cleanup of table on work unit replacement