updated code for ladder