Reorganize enter / exit code a bit.