further refactor of #125