A little refactor.
Changed to handle focus in a more sane way.