Cleaned .write statements, changed logging format