Cleaning up docs and making private js functions