Implemented abstract factory and other changes.