This paper presents an original method of designing reversible circuits. This method is destined to most popular gate set with three types of gates CNT (Control, NOT and Toffoli). The presented algorithm based on graphical representation of the reversible function is called s-maps. This algorithm allows to find optimal or quasi-optimal reversible circuits. The paper is organized as follows. Section 1 recalls basic concepts of reversible logic. Especially the cascade of the gates as realization of reversible function is presented. In Section 2 there is introduced a classification of minterms distribution. The s-maps are the representation of the reversible functions where the minterms distribution is presented. The choice of the first gate in the cascade depends on possibility of improving the distribution. Section 3 describes the algorithm, namely how to find the optimal or quasi-optimal solutions of the given function.