continue moving spaghetti code into classes

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