A modern approach to magnetism