Fix misc crap, remove neat easily readable switch statement and replace with if statements to reduce "complexity", variables and function names to lower case etc.