Remove duplicated code again: avail and hash