Updated helper function
added scroll up on length > 5