How electricity and magnetism work