formulate function