Update and improve for Haxe 3