refactoring in prep for better platform support.