Adds 'when' test with fixes
WIP