fixed a typo and formatted the code to be more readable