refactoring for #12