Clean up unused variables, throw in destructor and signed unsigned comparisions for debug mode compilation