major efficiency bug (func call in for cond) fixed