optimizing lookups and storage and profiles; enhancing tests