Cleaned up line buffering