Finished De implmentation. Fix match bug in random factory.