refactor to use func instead of function, as safari blew up.