Added connection check and minor UI rearrangements