Added pickle function to log data