Cleaned and added some comments