Simplification funcion was refactored.