Hotfix

Fixed if-statement bug
Fixed infinite loop bug
Changed if-statement logic to switch logic