Refactor buffer and code vector access.