refactor to make use of proper parts of the runtime