Started heavily refactoring code for better desing/style.  Interim commit - broken