Refactoring code to avoid warnings.