Update: minor performance improvement to buffering script.