Add WPLHandler and eliminate duplicate code