re-wrote preferences dialog