use more nested datastructure, use lambda instead of defining attrs function