changed function call using apply