implementing better pagination
updated logic to change sections back to original state on change