Base for new joint scheme. Broken commit so far.