generalized avail types for easier debugging
refactoread avail code
refactored availability code
refactored availability code