Stretching often is done instinctively after waking from sleep , after long periods of being inactive , or after leaving small spaces and areas . Stretching often occurs instinctively after waking from sleep , after long periods of inactivity , or after exiting confined spaces and areas .