added handling for expanding from collapsed state