split MA into multiple functions