Some refactoring

The function getImageSource has now been placed in a new global helpers
file.