More core work, compiles now (not yet fully working)