erasing unnecessary frames