update to make it work with jakes functions