implement scroll function