Added implementation for the cast special fn.