Re-nesting main to contain primary and secondary