James -- some refactoring