added code to add preferences