Cleaned up the code (indentation, comments, etc.)