Factory test and further cleaning up