added function comments and cross-platform read