refactors fact script