Fix typo, refactor slightly