HaroldT: Extract listeners and bean connection logic to share between debug and main activities.