moved custom functions