Fixed some OO stuff, removing global variables