Added events
Added events and event listeners
output style
renamed bufferClean to cleanBuffer and bufferFlush to flushBuffer
renamed internal methods also