finished js functions