slight refactoring, make pocket.py more opaque