Refactoring

refactored code / headers. Still working on this, but at this point, the code still works...
More cleaning up.