Add cast function; Update documentation