what affects the quality of sleep