porting util code from pagerlib into more modular library