implemented html generation based on options