Updated all the code so it builds with GCC 4.7.3