Fixed formatting and bad practice

I found a lot of if/else instead of a switch statement and I fixed the whole double and single quote issue, and I also improved readability and made the format of it fit with the original formatting.
This is generally considered very bad style, and was what caused Apple's SSL bug.