Invalid termination of logical structure. Refactoring.