add comments and fix template