Moved buffer to top of function.