Session management and other tweaks