added exports, changed some things upon learning that array.forEach is synchronous