Square Inscribed in a Triangle Problem

I started my construction by creating a triangle using 3 points and connecting the points using line segments. I then created point D on the segment AC and created a circle with radius DF. I used the compass tool to make another congruent circle to create another side FI of the square. I used the perpendicular line tool to create the rest of the sides of my square. To use this model, we would need to drag point C to make the square larger or smaller. Since the square needed to have all of the vertices on the edges of the triangle, I found the point H by creating a line through E parallel to AC. If we drag point D such that EI=EH, I noticed that this would create our desired square. I am still trying to figure out how to construct a square inscribed in a triangle that already has all 4 vertices on the edges of the triangle. Another issue with my model is that if I drag point B to the left of the line ED, the square and the circles vanish due to the way I constructed the model.