Beginning to refactor program structure. Moving all functionality into namespace, making everything cleaner and fleshing out some documentation.