Pretty much a complete rewrite/reorganization