Ongoing cost reductions helped the nation’s largest bookstore retailer narrow its loss in its fourth quarter even as its sales continued to slide.

Barnes & Noble posted a net loss of $13.4 million, or $0.19 per share, for the quarter, compared to a loss of $30.6 million, or $0.42 per share, in the prior year. For the quarter, the company’s retail division generated an operating loss of $15.9 million, while Nook incurred an operating loss of $7.9 million, for a total operating loss of $23.8 million.

Total sales fell 6.3% to $821 million for the quarter, ended April 29. Same-store sales declined 6.3%. Online sales increased 2.9%.

For the full year, Barnes & Noble reported sales of $3.9 billion, down 6.5% over the previous year. Comparable store sales declined 6.3% for the year. Online sales increased 3.7%.

“While fiscal 2017 proved to be a challenging year…