some refactoring, better tests for pinw-fetch