Move all actions onto a thread.
Fix auto-added block around javascript.