make it work for js functions