Tiny optimizations

Added again the simple optimizations, without the pin management change