Removing unused variables, fixing signed vs unsigned warnings
Fixing a bug I just introduced while fixing warnings