Code cleanup: collapsing two long methods into one

- also removing unused Base class.