Update RW.js

Added comments and cleaned