how money worked in the middle ages