code and tests moved from blue-button