functioning trimNet, needs memory optimization
tweak