Updates sql, and hooks up preferences page