Updated code to include advanced formula