an assortment of optimizations and formatting