Updated the avalability calulations.
Avalability code is still vastly oversmplified though