Reactor class. indentation screwd up
fix bug, add test
few fixes/cleanup