cleaned up some more and made it actually work