updated function definition for toHtml method to include optional parameters and added docblocks (this was causing strict warnings)