Added format param to write methods