complted refactoring of HTTP analysis into smaller clearer functions