Cleaned up some type mismatch warnings and removed some unused variable declarations