Auto switch tabs, when clicked and small cleanup.