it’s probably sufficient to use factor; see other posts and the repo for examples/details, e.g. this post
factor