@schiesbn please consider an edge case when $availableSpace is 0. the code below is still needed for this case.