handle edge cases and UI improvements