API query functionality added. SiteMap handling migrated.