Fixed issue, typo, tests, refactoring