restructured main file