Refactoring computations of first sets and closures