added arrows, refactored code