Small updates for speed and debugging
Getting ready for changing the massive if into a switch
Change to switch, may caused bugs