added code for formula