Adapted code to the latest changes.