Add comments to pin.js, refactor some methods in trails and users