Instead of needlessly duplicating code, why not refactor `get_free_space`?