Switched more loops to whiles and woking on modeler opt