refactored pretty much everything. it works!