major changes and refactoring of code based on newer design spec