Avoid annoying warnings. Rewrote to fit pedantic mode build.