Refactored convert to switch
Added support for a(a+b)=a*(a+b) notation