fixed typo
refactor code