Refactored code to use connection manager class. Need to test if pairing
is still functional.