refactored analyze to debug