Refactoring the code as advised by HoundCI.