split factor into lib and repl