Switched to uint16/32_t for better portability