Refactor parallel code (messages); collapsed v2