Improve and document low-level PEM read routines