refactor fatal function to helper script