added buffer_t
use buffer_t to print array
use buffer_t to print map
print to buffer (more efficient)