factor out shared structures into a separate file