Fix signed vs unsigned comparisons
Remove some dead code