Fixing a few warnings and ensuring everything is initialised correctly.