Complete code overhaul.  Parts work, parts don't