Evan, Good call on adding support for static buffers as well, this will make this function more versatile. I just pushed a few further tweaks (I explained the reasoning behind each change in commit log messages) and reverted the name change as Mukund makes a good point IMHO. As most of these latest modifications are basically bikeshedding, feel free to revert them to any extent you deem appropriate if you have strong feelings about any of them. Once you are happy with the end result, please let me know and I will merge it. Thanks!