added formatter and factory tests and fixes