added line buffered mode