some refactoring genalerts in new py file