Refactoring the choose dialog in order to be able to reuse parts of it for the login dialog.