Overhaul _lib.c to use uint_t
Clean up includes