Removed global variables and fixed few bugs. OO+