works with other functions as well