split rendering into a separate thread