beginning logic on image order