add write_info() to make code more readable