Fix issue #165 by reorganizing header files