how nerve impulses are generated and transmitted