Added a typecast function