further work porting dnoved1's code to forge