Added data logging functionality