Improve auto expand behavior
Improve auto_expand behavior