adding Readme documentation and fixing javascript algorithms