Refactored code, added controls for inserting formula with existing name