Refining image upload algorithm.