Rearrange preview code. Minor UI edits