Added support for function definitions and comment toggling.

Hi. please consider adding these to your package.
I snipped them out of the python package and they work wonders.