cleanup and changing unsigned to int a lot