rewrote main, not done yet though