Adding ruler correction logic