fixed issue: Crash with added analyzer code #7 and small refacor, the code is not pretty, but works for now. also added a single test