Refactored all the code to use the raw context