porting io code from pagerlib into more modular library