Updated to fit the new code