Added logic to cast datatype