Remove more hash lookups. Decrease nesting.