code cleanup
now handles get_buf