Full rewrite of everything