Updated as per new code