1st major step of refactoring finished, though something not quite write with critical lines right now. need to debug