some cleanup
basic architecture in-place