works as intended with this commit. now need to add some logging and comments as well as settings