Improved code to compile with -Weffc++ compile option.