changing globals to objects, hopefully I don't break anything