More numpy optimization