reworked the calling code