Commented and refactored the code a bit