Cleaned the code up

Much needed re-organization of everything before I get too far into v2