Small code optimizations. Thank to @tzurbaev (c2539)