added comments and modified the templates a bit