first stab at pjs reorg and minimal scoping