refactoring of krake slave to include unit testing