adding factories and lots of other changes