Separate pixel location and retrieval logic
More typical javascript iterator: not used yet but should be much faster