modified to return only first output argument instead of two. But this doesn't change what the code does.