many edits to handle outputs!