changed javascript pattern