overhaul clark, add tests and structure