Separated image reading code from main app