js functions completed