Added extensive comments