Fixing uninitialised values & minor cleanup