move codes to ImageStore.hs