more changes to make code portable