Move declarations closer to the action