big cleanup, rearranged code, and renamed files for simplification.
Identified a bug but have not fixed it yet.