layout tweaks and implementation of exit functionality