cleaned up code and fixed typo. no functional changes