Add function to record for error bars