Change from raw mysql calls to $wpdb. Patch from Simon East.
Updated change log.
Small refactor.