Fixed typo and cleaned up code a little