@SuppressWarnings("unchecked")
    public T remove() {
        while(true) {
            final long s = state.get();
            int slot = -1;
            for (int i = 0; i < 32; i++) {
                if (get(s,i) != FULL)
                    continue;
                slot = i;
                break;
            }
            if (slot == -1)
                return null;
            
            T item = (T)storage[slot];
            long newState = free(s,slot);
            if (state.compareAndSet(s,newState))
                return item;
        }
    }