refactoring of #37 work