Refactoring std for ultimate portability

@jethrogb Any progress? I’d love to help.