small optimizations + static typing