refactored inconsistent type analysis (for understandability) + wrote some tests for it