changing command.hpp to use the write_iteration function