Adapting code to new model