Extracted image parsing to sepparate function