US Civil War Uniforms; What Was This Symbol?

In Civil War ea photographs, union soldiers are frequently seen with a badge (which looks like a hunting horn) on their caps-what did this signify?
Also, on the CSA side, officers had diffeent cuff colors on their uniform jackets (yelow for infantry, red for cavalry (I think))- how did the Federal army identify is service braches?

I believe the bugle is for the infantry, crossed swords are for the cavalry, and crossed cannons are for artillery.