Updated WP2P and minor code refactoring