WP-2361 New api functions and some cleanup