* refactor of new function, use a subroutine to reduce cyclomatic complexity
* refactor of new function, use a subroutine to reduce cyclomatic complexity

dwvanstone/buttonmen,dwvanstone/buttonmen,dwvanstone/buttonmen,dwvanstone/buttonmen,dwvanstone/buttonmen,dwvanstone/buttonmen