Added additional code for testing and more comments