Updated to write logs