Some refactoring to prevent some errors and warnings.