Improved logic and UI