Add id to HTML elements

Also:
- rename function
- phpdoc
- misc stuff