Finally implemented preferences with pragmas the right way.
Finally implemented preferences with pragmas the right way - second try