Commented and made more user friendly.