Further optimizations and compiler stuff