add comments and formatted code