add slave and subslave cleanup code