added some comments, cleaning up code
merged files