Updated to work with WP 3.9