clearned up pin, and add comments