Updated the level  logic