Updated to use log(n) to size char buffer