refactoring scripting adaptors to improve testability