refactoring to #219