Added more code comments for further clarity.