removed some debug stuff, added more comments.