split function into files, to use with browserify