Implemented toolHistory array instead of selected and previously selected tools. It seems to work, but I havent done a lot of testing. Also some console logs to remove. toolHistory code looks really ugly. Possibly a new variable name.