Fixed some switch statements and formatting