Reduced global vars and changed to to automatic properties.