preview fixes
some refactoring