refactored, broke some stuff, but its better now.