using proper C++ types, and getting rid of non-standard "uint"