Added isLadder helper function