Added apply function.