modified js accordingly