replaced all charAt() with ch