Updated code to work with Haxe 3