refactoring and testing grid engine adaptor