Structuring and base algorithm reworking