Added some methods for testing and cleaned up a bit.