moved globals to instance vars on main view