updated to use JS API v 3.2

Added some comments