Added more comments to increase how verbose the code is.