Implemented proper typecasting.