some more involved javascript