improved portability and docs