WP2P communication and minor code refactoring