added a bunch of logic, broke everything