refactored textworker and previewbuttonlistener