adding objects instead of global variables