Improve tab behavior and URL handling