The factors to do with demographics and so on that have been mentioned are very important. From the West Lothian point of view, our performance on delayed discharges deteriorated quite significantly about 18 months to two years ago. We took a number of decisions to remodel the entire service, which we are now working through.
When it comes to seeking information from elsewhere, we sought information from Aberdeen city about the plan that it had at the time and the actions that it had put in place, and we have been in contact with our colleagues in Glasgow and various other places. We have made significant improvements, mostly in the past six months, as a number of those actions have come into play. There have been significant reductions in delayed discharges, occupied bed days and various other things, but there is still work to be done. We have learned from the previous framework agreement that we had for care-at-home services, and we are about to go out to procurement for a new framework agreement, which will be radically different from the previous one.
During that time, we also had a number of operational challenges that were outwith our control. In the care home market in West Lothian, for example, all our care home beds were full. We had no care home beds available and we were waiting for vacancies to arise. Therefore, we have worked closely with the care home providers to negotiate additional beds. In addition to the part of the care home sector that we procured and commissioned, about 25 per cent of it comprised people who were self-funders or beds that were purchased from other local authorities. We have tried to get some additional beds to give us a higher proportion of the number of care home beds. We are now starting to get those additional beds. We have worked very closely with the care home providers on that.
Another operational challenge that we faced with care homes was that a number of them were under investigation because their grades had dropped. When that happens, quite rightly, they do not take any new admissions. That does not sound like much, but such an investigation can mean 120 beds not being accessible for admission. It can take six months for a home to get the necessary assurance and be open for admissions again. We have had two or three care homes under investigation over the past two years. We have also had major challenges in the care-at-home sector. Unfortunately, our largest provider has been under investigation, and we have had to work very closely with it on an improvement plan before it could accept new cases.
All that, added to the change in demographics and the increase in demand, had a fundamentally negative effect on our performance. As well as working closely with the care home providers and the care-at-home providers, we have been remodelling our in-house service to address the negative performance. We have invested in our in-house service so that new cases for assessment and reablement, for example, come through that service before we ask a care-at-home provider or a care home provider to take them on. That is work in progress.
We have faced a number of significant operational challenges, which we will deal with. There will be a number of others, but it is a case of being flexible and dynamic in response to the challenges that arise.