Refactoring

Refactoring of codebase so as to consolidate functionality and simplify modules. Components are now more or less independent of each other save specified integration points and are better organized.