Code cleanup
Major restructure. Behaivor based on args.
Start of work on state machines