[David] Cleanup
[David/Kate] Refactor dynamic dispatch code