Removed some unneeded code and fixed warnings