better sanity-checking, completed stubs for tag helper and refactored it a bit.