remove unnecessary stuff, change everything to unsigned, needs better style