minor refactoring in methods.