refactored analysis