to avoid warnings, changed coltype to unsigned char, and removed some
unused variables