Improved result output
Made some minor changes to the when implementation. Closes #29.