Refactoring

this isn't portable