Add defun boilerplate to deffigure

Also a lot more documentation and formatting changes