remove stray data logging
move package write to end of function to we get all the needed vars before writing