Some more restructuring...i may scrap everything but the algorithms because this code is iffy.