working, amidst refactoring
some refactoring.