updated availability logic