added function for checking internet connetion.
Also did some layout stuff