Improved Preference Dialog and Pages API. Fixes #782