General clean up and abstraction.