Updated Factory and Document classes. Still WIP.