Some code layout cleanup.
Abstracted some logic.
Readme updaet and some more code cleanup.