big changes to accomodate cross-linux portability