added user choice handling, with tests