Not sure what is up with the checkAvailability function