Various changes - into while-loop