Made the screen-wrapping code slightly more abstact.