Better organized the structure for the background client and piClient