Finished JS and fixed some memory an pointer issues