UPDATE:
 - fixed a few warnings (GCC 4.8 appears more pedantic than 4.6)