Code inspection & test fixes