Code climate and test fixes