Added new code to petal.js