For more than a year now, The Herald's NHS:

Time for Action campaign has been highlighting the problem of bed shortages in Scotland's hospitals. This summer, for example, the shortages meant more than 3,300 patients had to be treated in the wrong department for their condition. Part of the problem is that the much-needed beds are often full of patients who are well enough to be discharged - in July alone, 1,706 patients were in this situation.

In many cases, the patients who are well enough to be discharged are forced to stay in hospital because there is no place for them in a care home or the social care package they need in the community is not ready. This is a serious problem in Scotland's NHS and better co-ordination between hospitals and community-based care services is needed to address it.

However, it is increasingly clear community care is only part of the problem, with two leading clinicians telling The Herald today that the delays in social care services do not account for all of the hold-ups.

According to Professor Derek Bell, president of the Royal College of Physicians of Edinburgh, and Dr Martin McKechnie, chairman of the College of Emergency Medicine Scotland, many cases can be explained by hospitals not working as efficiently as they could.

Professor Bell and Dr McKechnie are not the only ones who believe this. Last week, the NHS watchdog Healthcare Improvement Scotland expressed its concern about the flow of patients through hospitals and said that in some cases hospitals were failing to take the action needed to plan the discharge of elderly patients.

Dr McKechnie's view is that lessons could be learned from accident and emergency, where there is a target of discharging most patients within four hours and a high degree of focus on moving patients through the system. He and Professor Bell believe other parts of the hospital system could be more focused on discharge in a similar way.

If such a focus on efficiency can avoid, or reduce, the problem of patients taking up beds when they are well enough to go home, it should be pursued, not least to avoid frustration for the patients themselves and their friends and family. Wards should be organised as efficiently as possible so that the right staff, drugs or resources are available when they are needed.

However, there are some risks in focusing much more on efficient planning for the discharging of patients. The most serious is the risk of a revolving door scenario in which patients discharged too early reappear in hospital a short time later. A focus on when a patient is discharged should also never to be allowed to interfere with the good care while in hospital.

On the other hand, the problem of bed blocking will not be solved by improvements to community care alone. A nationwide review is required to ensure hospitals have the right beds in place at the right times, but as an essential part of that review, hospitals must look at how they can improve their planning for the treatment and discharging of patients.