some refactoring
image mapper function now uses callback to notify the caller when ready