javascript code improved...