implementing apply