code cleanup: html creation code moved to the separated functions