Addding mouse listener logic