added runForOutput function