cleaning up code as I change to buffer wrappers