code commentary + slight cosmetic changes