factor out user interface