All code for availability present with working tests

now integrate