Cleaned up imports and refactor base factory class