bring in more code from zbot and make purdy OO classes

Signed-off-by: Joshua Rubin <jrubin@zvelo.com>