The present invention relates to a modular electronic assembly for a device usable for performing endoscopic procedures, wherein the modular electronic assembly comprises one or more first electronic components, a first circuit board configured to carry the one or more first electronic components, wherein the first circuit board is flexible so as to allow the first circuit board to be folded from an unfolded configuration to a folded configuration, one or more second electronic components, and a second circuit board configured to carry the one or more second electronic components. The second circuit board is flexible so as to allow the second circuit board to be folded from an unfolded configuration to a folded configuration. The folded second circuit board receives the folded first circuit board therein.