Updated docs, added comments and made initial improvements to TypeFactory