Refactor wrap_xmodule call