Added timeout parameter to connect_monitor, blocked out code into
discrete scopes. Probably a bit overkill but working so far. Confirmed
tests work.