improve connection detection and VASTLY improve find functions