rewrote main file