Update code to adapt to new schema