removed switch statement from builtin apply