Updated to consume properly (timeout issue)

I also cleaned up some of the code and added some comments and javadocs.