moved out doAction
moved pointer out to global