Can simplify that.
Add casting of output value, too.