How did guilds affect the way medieval townspeople made a living