Deleted unnecessary code, cleaned formatting, and fixed warnings