Refactored the arrow code to use canvas