greatly complete most of the rewrite, indenting basic things correctly now