miscellaneous source code for portable reading