Reformatted some code. Fixed some spelling errors. Added a missing destroy of preview component.