Added PrefDevice and more unit tests