Modified process function