various optimizations and test updates