minor changes to make it work with WP