Fixing casting issue/format the code