first semi-working implementation; reactions still do not run completely correctly