Started initial re-write

TODO - address all lines that are commented.