refactor duplicate forge code portion into function