More uint to int changes, migration to const functions and bugfixes.