Cleaned up commented code and improved formatting