the code i've used to record data