Refactoring
Improved preference reading
Improved logging