more refactoing, hopefully things still work!