Update code to check free space