Preferences setting works correctly.
Refactored Service Factory and some other classes.