Clean up key select dialog and some codestyle housekeeping