added when method, passing test
Merge pull request #39 from milktrader/when

added when method, passing test