cleaning up html tah handler logic to properly enforce configured rules