Code to handle equations correctly.