I finally figured out my own code