Modified js as per comment