This paper presents a new computational method based on the feasible-set method (Berndt, Kucharik, and Shashkov, 2010, “Using the Feasible Set Method for Rezoning in ALE,” Procedia Comput., 1(1), pp. 1879–1886 and Vachal, Garimella, and Shashkov, 2004, “Untangling of 2D Meshes in ALE Simulations,” J. Comput. Phys., 196, pp. 627–644) for removing inverted elements in surface and volume meshes. The proposed method calculates a region for each node called a “feasible set” in which the node can reside without creating an inverted element. The node is then relocated within the region so that the number of inverted elements is reduced. Unlike the original feasible-set method, it is applicable to nonplanar surface meshes, volume meshes, and also has a step for recovering a feasible set when the set is empty. While various useful mesh optimization techniques have been proposed over several decades, many of them do not work well if the initial mesh has inverted elements. Additionally, some mesh optimizations create new inverted elements when the mesh topology is highly irregular. The goal of the proposed method is to remove mesh inversion without creating a new inverted element. The proposed method is useful for preconditioning for conventional smoothing techniques, which require that the initial mesh be inversion free. It is also useful for correcting inverted elements created by conventional smoothing techniques. The effectiveness of the improved method has been verified by applying it to the facet-repair and the boundary-layer generation problems.