Added documentation to preferences code