add phpdoc hints for controls in template files
add phpdoc for reference arguments
refactor to make customization easier