Logic and UI improvements.