code cleanup for handling connections on the UI layer