Added support for const buffers where applicable.