Add functions for rectangle and triangle.