Fixes for compiler warnings

- unused vars
 - init ordering in constructors
 - static vars and functions in header files