Code cleaned and added comments.