change code to new schema