Cancel connection if it is already loading

Also I updated the code to the recent obj-c writing style guides