even more comments and reformatting code for readability