Added replaceKeys method