replacing try-catch with conditional
retain position during space removal