adding up-arrow scrolling and some more code refactoring