Added checking that all arguments were provided. Switched many variables to use size_t, and int8_t where appropriate. Moved opening braces on to previous lines, except function braces. Renamed set_bits to more-accurate index_bits.