Factor context lifting into separate module