compose funciton and tests