Further tweeks and optimizations