adding ability to specify beforeBuild function