initial pass at porting stuff over...there are lots of bugs

Change-Id: I8278b1c8b1ef9ac94937a70c8ec1a7bf188d45bb
Made shell scripts work

Change-Id: Icb6485bea3a608c6d2ad099668646df0ba1a381f
make input ordering more sensible

Change-Id: I508a4757f83999700ca7f80d65d8cff679f6f21e