More cleanup, and work towards a more compelte implementation.