Handled some connection problems
Improved quality detection