preferences code completed