some more refactoring and beginning of the raid feature