Refactor ex buffer