Updated code

Added PHPDoc comments, moved the tld extraction  functionality inside a function and revised comments.