Continuing the comment above, here it would be simply

InputBuffer first;
InputBuffer second;

with the rest of the code changed accordingly.