added a version without all the commenting to make it easier to understand (hopefully)