Fixed typo and narrowed the code.