Fixed factory generation, refactored a ton of tests to pass.