changed structure, added diagram