Updated code to look better and included some better comments.