More cleanup, encapsulation, etc