neaten the code of image fecthing