updated scroll logic