I prefer your more compact error checking than mine, it didn't cross my mind to write it this way. I will change this alongside with the more critical issues you addressed below.