fixed null pointer errors, beginning to refactor object factories