Refactor a little to add common base classes