Optimised some if conditions
Corrected some minor spelling errors