Adjust code to adapt the level changes