optimizing for speed and size