starting to rewrite the whole thing