Code and tests for the phase software