Bunch of mods to get it to run in build system, still buggy.