Profile image code optimization