Fixed api calls, reworked sample.
Added case expression.