Miscellaneous optimizations