this will still end up doing lots of database queries regardless of how few profiles there are. Comments will appear above with additional suggestions.