Switched from size_t to unsigned int + some typedefs