Analysis enhancements and refactoring