before clean up
less messy, not great yet
works with images where the size is not a multiple of atoms