threshold(): Changed Int32 -> Int for Haxe 3 compatibility; Added Memory.select(null) at end of function calls.