moved updateArrows down amongst the helper functions.