restuctured main