Organisations of artists or other tradesmen formed beginning in the Middle Ages. As in today's unions, the guilds supervised work conditions, the number of apprentices, and materials used. The guild was also an agent in providing materials for the artists to use, such as panels, that had to sometimes be stamped with the guild's seal before they could be used. All artists were required to join a guild unless they were under direct orders of the ruler. As time went on, the guilds were replaced with the academies, whose main function was teaching.