Added replaceMetadata(), replaced 'num' in queries with' limit'