WP-3060 Added setting for itemid and some code cleanup