added a constructer to set preferences