puzzle factory with unit tests added