Ported to Haxe 3