No error checking at low level of connection library. Do higher up.
Changed variable name and fixed bugs