Collapsed test and when into one phase
Better tests and docs