getNewmask improvements, loop bug fix
removed outputs