eliminating compiler errors

I was getting compiler errors (on gcc 4.8) caused by using user-defined type names as identifiers, and missing includes.