updated to accept stderr