code cleanup, slight refactoring to make things more granular.