Clean up dynamic initialization code. Add factory and map classes. Rework engine and entity creation.