You can reuse $freeSpace in the second condition