Add basic docstring, clean up code a bit
bin/templet: add some docstring, clean up code a bit