adding JS logic