more work on javascript code