Improves the code of the formal methods function