Added checks so that arrows don't appear when another arrows is about to leave the screen
Merged changes in main.js