improve syntax and add comments