Refactoring for #8