Cleaned up a lot of the prototype code