add more error handling/detection and os detection