Optimization of Bootstrapping in Circuits