removed some testing code and added some comments