Made buffer size configurable.