refactor and some new features
typo fix