Checking for is space released and refactoring