cleaned up files, added docstrings and comments in javascript