Made it so everything actually runs (some bugfixes and corrections to
inference included)