rewrote the initial version + demo using hxcpp magic