Optimizations and tweaks and stuff