Lots of improvements to get things working with multiple OS types

Signed-off-by: Ken Barber <ken@bob.sh>