Whether entering or exiting, Lily is finding out she can only go when given permission. This prevents door dashing and helps her maintain that you are her leader. Coming inside after her evening romp in the yard, it also promotes calmness! What a good girl!