moved check statements into new method. Established connection