Changed to using preferences