Change gallery to store ID as key