Added support for multiple when and thens