Not perfect, but the basic structure is there