Updated to use return values for better race conditioning control