switched to named functions as suggested in #16