Refactored html and url -checks to use same code