changed default return code from 3 to 2 and added some connection error checking