Added a bunch more comments for clarity