added caching and joins to reduce roundtrips to server