refactoring preconditions routine