Making the preview feature more flexible for a more app-wide usage
Code refactoring